import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/dashboard',
    children: [
      // 仪表盘
      {
        path: '/dashboard',
        name: 'Dashboard',
        component: () => import('../views/dashboard/index.vue'),
        meta: { title: '仪表盘', icon: 'DataLine' }
      },
      // 财务管理
      // 报表统计
      {
        path: '/report',
        name: 'Report',
        meta: { title: '报表统计', icon: 'PieChart' },
        children: [
          {
            path: 'stock-in-report',
            name: 'StockInReport',
            component: () => import('../views/report/stock-in.vue'),
            meta: { title: '入库报表' }
          },
          // {
          //   path: 'sales-order-report',
          //   name: 'SalesOrderReport',
          //   component: () => import('../views/report/sales-order.vue'),
          //   meta: { title: '销售报表' }
          // },
          {
            path: 'inventory-report',
            name: 'InventoryReport',
            component: () => import('../views/report/inventory.vue'),
            meta: { title: '库存报表' }
          }
        ]
      },
      // 基础资料
      {
        path: '/basic',
        name: 'Basic',
        meta: { title: '基础资料', icon: 'Setting' },
        children: [
          // {
          //   path: 'product',
          //   name: 'Product',
          //   component: () => import('../views/basic/product/index.vue'),
          //   meta: { title: '商品管理' }
          // },
          {
            path: 'shop',
            name: 'Shop',
            component: () => import('../views/basic/shop/index.vue'),
            meta: { title: '店铺管理' }
          },
          {
            path: 'warehouse',
            name: 'Warehouse',
            component: () => import('../views/basic/warehouse/index.vue'),
            meta: { title: '仓库管理' }
          }
        ]
      },
      // 入库管理
      {
        path: '/stock-in',
        name: 'StockIn',
        meta: { title: '入库管理', icon: 'FolderOpened' },
        children: [
          {
            path: 'create',
            name: 'StockInCreate',
            component: () => import('../views/stock-in/create.vue'),
            meta: { title: '新建入库' }
          },
          {
            path: 'list',
            name: 'StockInList',
            component: () => import('../views/stock-in/list.vue'),
            meta: { title: '入库单列表' }
          }
        ]
      },
      {
        path: '/sales',
        name: 'Sales',
        meta: { title: '销售管理', icon: 'Money' },
        children: [
          {
            path: 'order',
            name: 'SalesOrder',
            component: () => import('../views/sales/order/index.vue'),
            meta: { title: '销售订单' }
          }
        ]
      },
      // 库存管理
      {
        path: '/inventory',
        name: 'Inventory',
        meta: { title: '库存管理', icon: 'Box' },
        children: [
          {
            path: 'query',
            name: 'InventoryQuery',
            component: () => import('../views/inventory/query.vue'),
            meta: { title: '库存查询' }
          },
        ]
      },


    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router 